﻿using System;
using System.Collections.Generic;
using System.Threading;
using Behaviours.Configs;
using Behaviours.Network;

namespace Behaviours.Entities
{
    /// <summary>
    /// 代表整个游戏世界,即这个程序
    /// </summary>
    public sealed class World
    {
        public static Options option;
        public static readonly ThreadSynchronization SynchronizationContext = new ThreadSynchronization(Thread.CurrentThread.ManagedThreadId);

        public static List<Action> FrameFinishCallback = new List<Action>();

        public static void Update()
        {
            SynchronizationContext.Update();
        }
        
        public static void LateUpdate()
        {
            // EventSystem.LateUpdate();
        }

        public static void FrameFinish()
        {
            foreach (Action action in FrameFinishCallback)
            {
                action.Invoke();
            }
            FrameFinishCallback.Clear();
        }

        public static void Close()
        {
            
        }
    }
}